<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<object id="LODOP" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0></OBJECT>
<script type="text/javascript" src="<s:url value='/resources/js/jquery/jquery-1.5.2.min.js'/>"></script> 
<script type="text/javascript">
	$(function(){
		print();
	}); 
	
	function print(){
		AddTitle();
		var iCurLine=215;//标题行之后的数据从位置80px开始打印
		var goods=$("#goods>tr");
		for (var i=0; i< goods.size(); i++) {
			var objid=$(goods[i]).find(".objid").text();
			LODOP.ADD_PRINT_TEXT(iCurLine,15,150,20,objid);
			var name=$(goods[i]).find(".name").text();
			LODOP.ADD_PRINT_TEXT(iCurLine,90,120,20,name);
			var num=$(goods[i]).find(".num").text();
			LODOP.ADD_PRINT_TEXT(iCurLine,170,80,20,num);
			var price=$(goods[i]).find(".price").text();
			LODOP.ADD_PRINT_TEXT(iCurLine,210,80,20,price);
			iCurLine=iCurLine+25;//每行占25px
		}
		LODOP.ADD_PRINT_LINE(iCurLine,14,iCurLine,270,0,1);
		
		LODOP.ADD_PRINT_TEXT(iCurLine+5,20,300,20,"打印时间："+(new Date()).toLocaleDateString()+" "+(new Date()).toLocaleTimeString());
		
		var total=$("#total").text();
		LODOP.ADD_PRINT_TEXT(iCurLine+30,20,150,20,"合计金额："+total);
		//LODOP.SET_PRINT_PAGESIZE(3,1385,45,"");//这里3表示纵向打印且纸高“按内容的高度”；1385表示纸宽138.5mm；45表示页底空白4.5mm
		LODOP.PRINT();
	}
	
	function AddTitle(){
		//LODOP=getLodop(document.getElementById('LODOP'),document.getElementById('LODOP_EM')); 
		LODOP.ADD_PRINT_RECT(5,3,270,370,2,0);
		LODOP.ADD_PRINT_TEXT(15,102,355,30,"现代旅游收款票据");
		
		var planid=$(".planid").val();
		LODOP.ADD_PRINT_TEXT(45,20,355,30,"行程编号："+planid);
		var agencyName=$(".agencyName").text();
		LODOP.ADD_PRINT_TEXT(75,20,355,30,"旅行社："+agencyName);
		var groupName=$(".groupName").text();
		LODOP.ADD_PRINT_TEXT(105,20,355,30,"旅行团："+groupName);
		var guideName=$(".guideName").text();
		LODOP.ADD_PRINT_TEXT(135,20,355,30,"导游："+guideName);
		var placeName=$(".placeName").text();
		LODOP.ADD_PRINT_TEXT(165,20,355,30,"购物场所："+placeName);
		
		
		
		LODOP.SET_PRINT_STYLEA(1,"FontSize",13);
		LODOP.SET_PRINT_STYLEA(1,"Bold",1);
		LODOP.ADD_PRINT_TEXT(195,15,100,20,"编号");
		LODOP.SET_PRINT_STYLEA(2,"FontSize",10);
		LODOP.SET_PRINT_STYLEA(2,"Bold",1);
		LODOP.ADD_PRINT_TEXT(195,90,100,20,"名称");
		LODOP.SET_PRINT_STYLEA(3,"FontSize",10);
		LODOP.SET_PRINT_STYLEA(3,"Bold",1);
		LODOP.ADD_PRINT_TEXT(195,170,100,20,"数量");
		LODOP.SET_PRINT_STYLEA(4,"FontSize",10);
		LODOP.SET_PRINT_STYLEA(4,"Bold",1);
		LODOP.ADD_PRINT_TEXT(195,210,100,20,"单价(元)");
		LODOP.SET_PRINT_STYLEA(5,"FontSize",10);
		LODOP.SET_PRINT_STYLEA(5,"Bold",1);
		
		LODOP.ADD_PRINT_LINE(190,14,190,270,0,1);	
	};

</script>

<style type="text/css">

</style>
</head>

<body >
	<div style="width: 9cm;line-height: 30px;">
		<div class="guideText">
			<input type="hidden" class="planid" value="<s:property value="payAccount.shopPlan.planid" />">
			<div style="">
				<span>旅行社：</span><span class="agencyName"><s:property value="payAccount.shopPlan.agencyName" /></span>
			</div>
			<div style="">
				<span>旅行团：</span><span class="groupName"><s:property value="payAccount.shopPlan.groupName" /></span>
			</div>
			<div class="clr"></div>
			<div style="">
				<span>导游：</span><span class="guideName"><s:property value="payAccount.shopPlan.guideName" /></span>
			</div>
			<div style="">
				<span>购物场所：</span><span class="placeName"><s:property value="payAccount.shopPlan.placeName" /></span>
			</div>
			<div class="clr"></div>
		</div>
		<div class="goodsList">
			<table style="" cellpadding="0" cellspacing="0">
				<thead>
					<tr>
						<td width="87px" align="left">商品编号</td>
						<td width="87px" align="left">商品名称</td>
						<td width="40px" align="center">单价</td>
						<td width="40px;" align="center">数量</td>
					</tr>
				</thead>
				<tbody id="goods">
				<s:iterator value="payAccount.goodsList">
					<tr>
						<td class="objid"><s:property value="objid" /></td>
						<td class="name"><s:property value="name" /></td>
						<td class="price"><s:property value="price" /></td>
						<td class="num"><s:property value="num" /></td>
					</tr>
				</s:iterator>
				</tbody>
			</table>
		</div>
		<div class="total">
			<span>总计：</span>
			<span id="total"><s:property value="payAccount.total" /></span>
			<br>
			<br>
		</div>
		<div class="clr"></div>
	</div>
</body>
</html>